<?php
/*
Autor: Marek Křivan
(c) 2009 
*/
if(intval($_SESSION['rank']) < 2){
	exit(WRONG_PERMISSIONS);
}
$id_tematu = 1 * $q[2];
$seo = ($GLOBALS['seo']) ? '' : 'index.php?q=';
if(isset($_POST['neodeslat_form'])) {

                echo "<meta http-equiv=\"refresh\" content=\"1;".$GLOBALS['url'].$seo."forum/dues/".$id_tematu."/".$q[3]."\" />";
        } 
if($_SESSION['rank'] >= 2) {
                if(isset($_POST['dulezite1'])) {
                       $query = $GLOBALS['db']->query("UPDATE " . $GLOBALS['db_prefix'] ."forum_temata SET dulezite = '1', posledni = '3000000000' WHERE id = '$id_tematu';");
                        echo "<meta http-equiv=\"refresh\" content=\"1;".$GLOBALS['url'].$seo."forum/dues/".$id_tematu."/".$q[3]."\" />";
                } else
                if(isset($_POST['dulezite0'])) {
                        $epoch = date("U");
                        $query = $GLOBALS['db']->query("UPDATE " . $GLOBALS['db_prefix'] ."forum_temata SET dulezite = '0', posledni = '$epoch' WHERE id = '$id_tematu';");
                        echo "<meta http-equiv=\"refresh\" content=\"1;".$GLOBALS['url'].$seo."forum/dues/".$id_tematu."/".$q[3]."\" />";
                } else
                if($q[4] == 1) { 
                        echo "<form action=\"".$GLOBALS['url']."index.php?q=forum/action_dulezite/".$id_tematu."/$q[3]/1\" method=\"post\"><fieldset><legend>Označit \"důležité\"</legend><label>Přejete si označit toto téma jako důležité?</label><input type=\"submit\" value=\"Ano\" name=\"dulezite1\" /> <input type=\"submit\" value=\"Ne\" name=\"neodeslat_form\" /><br /><br /></fieldset></form>";
                } else
                if($q[4] == 0) { 
                        echo "<form action=\"".$GLOBALS['url']."index.php?q=forum/action_dulezite/".$id_tematu."/$q[3]/0\" method=\"post\"><fieldset><legend>Zrušit \"důležité\"</legend><label>Přejete si zrušit označení důležité tohoto tématu?</label><input type=\"submit\" value=\"Ano\" name=\"dulezite0\" /> <input type=\"submit\" value=\"Ne\" name=\"neodeslat_form\" /><br /><br /></fieldset></form>";
                }
        }
?>
